package com.zhang.crm.service.impl;

import com.zhang.crm.mapper.TDicTypemapper;
import com.zhang.crm.pojo.TDicType;
import com.zhang.crm.pojo.TDicValue;
import com.zhang.crm.service.DicTypeService;
import com.zhang.crm.util.JSONUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DicTypeServiceImpl implements DicTypeService {
    @Resource
    private TDicTypemapper tDicTypemapper;
    @Override
    public Map<String, List<TDicValue>> loadDicToMemory() {
        List<TDicType> tDicTypes = tDicTypemapper.selectAllDic();
        Map dicMap = new HashMap<String, List<TDicValue>>();
        tDicTypes.forEach(tDicType -> {
            dicMap.put(tDicType.getCode(), tDicType.getDicValueList());
            System.out.println(dicMap.get(tDicType.getCode()));
        });

        return dicMap;
    }
}
